package com.viettel.pon.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.viettel.pon.R;
import com.viettel.pon.form.InfomationForm;


public class MyListAdapter extends ArrayAdapter<InfomationForm>{
	
	private final Context context;
	private final ArrayList<InfomationForm> values;
	private final int widthScreen;
	TextView txtTroubleType;
	TextView txtTroubleCode;
	ImageButton ibtEnvelope;
	LinearLayout llbtn;
	LinearLayout lltxt;
	InfomationForm item=null;

	public MyListAdapter(Context context, ArrayList<InfomationForm> values,int widthScreen) {
		super(context, R.layout.item_time_create,values); 
		this.context = context;
		this.values = values;
		this.widthScreen=widthScreen;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context
			.getSystemService(Context.LAYOUT_INFLATER_SERVICE);		
		item=new InfomationForm();
		item=getItem(position);
		View rowView = null;
		 ViewHolder viewHolder; // view lookup cache stored in tag
	    	   viewHolder = new ViewHolder();
	    	   rowView = inflater.inflate(R.layout.item_time_create, parent, false);
	    		viewHolder.txtViewTime= (TextView) rowView.findViewById(R.id.txtViewTime);
	    		viewHolder.txtViewTime.setTag(item);
	    	
		if(String.valueOf(item.getTrackName()).equals("null")){
			viewHolder.txtViewTime.setText(String.valueOf(item.getCreateDate()));
			}else{
				viewHolder.txtViewTime.setText(String.valueOf(item.getTrackName()));
			}
			
			
 
		return rowView;
	}
	private class ViewHolder {
		TextView txtViewTime;
    }
}
